//
// Created by LoveHoneyYou on 2024-11-16.
//

#ifndef WEBSERVER_EPOLLDISPATCHER_H
#define WEBSERVER_EPOLLDISPATCHER_H

#include <string>
#include <sys/epoll.h>
#include "Dispatcher.h"

class EpollDispatcher : public Dispatcher
{
public:
    EpollDispatcher(EventLoop* event_loop);
    ~EpollDispatcher();

    int Add() override;
    int Remove() override;
    int Modify() override;
    int Dispatch(int timeout) override;

private:
    int Epoll_Ctl(int op);

private:
    int epfd_;
    struct epoll_event* events_;
    const int Max_Node_ = 1024;
};

#endif//WEBSERVER_EPOLLDISPATCHER_H
